home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / gle / util / surf / curssscr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-11-29  |  2.4 KB  |  204 lines

  1. #include <curses.h>
  2. #include "vaxconio.h"
  3. #define false 0
  4. #define true (!false)
  5. delay(int i)
  6. {}
  7. int vx_top=1,vx_bot=24;
  8. textattr()
  9. {}
  10. kbhit()
  11. { return false;}
  12. scr_gets(char *x)
  13. {
  14.     getstr(x);
  15. }
  16. clreol()
  17. {
  18.     clrtoeol();
  19. }
  20. cputs(char *line)
  21. {
  22.     int x;
  23.     int y;
  24.     getyx(stdscr,y,x);
  25.     mvaddstr(y,x,line);
  26. }
  27. delline()
  28. {
  29.     int x;
  30.     int y;
  31.     getyx(stdscr,y,x);
  32.     move(22,1);
  33.     clrtobot();
  34.     move(y,1);
  35.     deleteln();
  36.     move(y,x);
  37. }
  38. gotoxy(int x, int y)
  39. {
  40.     if (y==25) y=24;
  41.     move(y+vx_top-2,x);
  42. }
  43. insline()
  44. {
  45.     int x;
  46.     int y;
  47.     getyx(stdscr,y,x);
  48.     move(y,x);
  49.     insertln();
  50.     move(y,x);
  51.     move(22,1);
  52.     clrtobot();
  53.     move(y,x);
  54.  
  55. }
  56. putch(int char_val)
  57. {
  58.     int x;
  59.     int y;
  60.     getyx(stdscr,y,x);
  61.     mvaddch(y,x,char_val);
  62. }
  63. int scr_refresh()
  64. {
  65.     refresh();
  66. }
  67. int scr_getch()
  68. {
  69.     return getch();
  70. }
  71. scr_init()
  72. {
  73.     initscr();
  74.     scrollok(stdscr,true);
  75. }
  76. scr_end()
  77. {
  78.     endwin();
  79. }
  80. textbackground(int color_num)
  81. {}
  82. textcolor(int colornum)
  83. {}
  84. gettextinfo(struct text_info *r)
  85. {
  86.     int x;
  87.     int y;
  88.     getyx(stdscr,y,x);
  89.     r->curx = x;
  90.     r->cury = y;
  91.     r->wintop = vx_top;
  92. }
  93. screen_save()
  94. {}
  95. screen_restore()
  96. {
  97.     scr_norm();
  98.     clrscr();
  99.     gotoxy(1,1);
  100.     cputs("\n");
  101. }
  102. int wyerr;
  103. w_message(char *s)
  104. {
  105.     wyerr++;
  106.     scr_savexy();
  107.     gotoxy(1,wyerr);
  108.     clreol();
  109.     cputs(s);
  110.     scr_restorexy();
  111. }    
  112. window(int left,int top, int right, int bottom)
  113. {
  114.     if (left==1 && top==1 && bottom==25) {
  115.         printf("\x1b[%d;%dr",1,24);
  116.     }     
  117.     vx_top = top;
  118.     vx_bot = bottom;
  119.     wyerr = 0;
  120. }
  121. clrscr()
  122. {
  123.     if (vx_top==1 && vx_bot==25) {
  124.         clearok(stdscr,TRUE);
  125.         clear();
  126.         refresh();
  127.         clearok(stdscr,FALSE);
  128.         return;
  129.     }
  130.     clear();
  131. }
  132. scr_dots(int i)
  133. {
  134. }
  135. scr_left(int i)
  136. {
  137.     int y,x;
  138.     if (i<=0) return;
  139.     getyx(stdscr,y,x);
  140.     move(y,x-i);
  141. }
  142. scr_right(int i)
  143. {
  144.     int y,x;
  145.     if (i<=0) return;
  146.     getyx(stdscr,y,x);
  147.     move(y,x+i);
  148. }
  149. int vx_topsave,vx_botsave;
  150. int savex,savey;
  151. scr_savexy()
  152. {
  153.     getyx(stdscr,savey,savex);
  154.     vx_topsave = vx_top;
  155.     vx_botsave = vx_bot;
  156.     
  157. }
  158. scr_restorexy()
  159. {
  160.     move(savey,savex);
  161.     vx_top = vx_topsave;
  162.     vx_bot = vx_botsave;
  163. }
  164.  
  165. scr_norm()  /* yellow on blue */
  166. {
  167.     clrattr(_BOLD | _REVERSE);
  168. }
  169. scr_inv()   /* black on white */
  170. {
  171.     clrattr(_REVERSE);
  172.     setattr(_BOLD);
  173. }
  174. scr_grey()  /* black on grey */
  175. {
  176.     clrattr(_BOLD);
  177.     setattr(_REVERSE);
  178. }
  179. scr_isblackwhite()
  180. {
  181.     return true;
  182. }
  183. scr_menubg()
  184. {
  185.     scr_norm();
  186. }
  187. scr_menuval()
  188. {
  189.     scr_inv();
  190. }
  191. scr_menuhi()
  192. {
  193.     scr_grey();
  194. }
  195.  
  196. #include <descrip.h>
  197. vax_edt(char *s)     /* call the vax EDT editor */
  198. {
  199.     $DESCRIPTOR(sdesc,"");
  200.     sdesc.dsc$a_pointer = s;
  201.     sdesc.dsc$w_length = strlen(s);
  202.     edt$edit(&sdesc,&sdesc);
  203. }
  204.